package messages.registration;

import messages.BaseMessage;
import messages.MessageType;

public class ElevatorRegistrationMessageAck extends BaseMessage {
    
    private byte clientId;
    private byte maxFloors;

    public ElevatorRegistrationMessageAck(byte[] data)
    {
        super(data);
        
        clientId = data[1];
        maxFloors = data[2];
    }
    
    public ElevatorRegistrationMessageAck(byte clientId, byte maxFloors)
    {
        super(null);
        
        this.clientId = clientId;
        this.maxFloors = maxFloors;
    }
    
    public byte getClientId()
    {
        return clientId;
    }
    
    public byte getMaxFloors()
    {
        return maxFloors;
    }

    @Override
    public byte[] toByteArray()
    {
        byte[] retVal = new byte[getMessageSize()];
        
        retVal[0] = getMessageType().getIdentifier();
        retVal[1] = clientId;
        retVal[2] = maxFloors;
        
        return retVal;
    }

    @Override
    public MessageType getMessageType()
    {
        return MessageType.ElevatorRegistrationMessageAck;
    }

    @Override
    public int getMessageSize()
    {
        return 3;
    }

}
